#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;
const int MOD = 998244353;

int n, m;
ll fac[N << 1], inv[N << 1];
int a[N];
ll p[N], pp[N];
ll fastpow(ll b, ll p) {
  ll res = 1;
  while (p) {
    if (p & 1) res = res * b % MOD;
    b = b * b % MOD;
    p >>= 1;
  }
  return res;
}
void init(int n) {
  fac[0] = inv[0] = 1;
  rep(i, 1, n) fac[i] = fac[i - 1] * i % MOD;
  inv[n] = fastpow(fac[n], MOD - 2);
  per(i, n - 1, 1) inv[i] = inv[i + 1] * (i + 1) % MOD;
}
ll C(int n, int m) {
  if (n < m || m < 0) return 0;
  return fac[n] * inv[m] % MOD * inv[n - m] % MOD;
}
ll F(int n) { return inv[n] * fac[n - 1] % MOD; }
void solve() {
  cin >> n;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, n) p[i] = (p[i - 1] + a[i]) % MOD;
  rep(i, 1, n) pp[i] = (pp[i - 1] + p[i]) % MOD;
  ll ans = 0;
  rep(i, 1, n) ans = (ans + 1ll * n * a[i] % MOD) % MOD;
  rep(k, 2, n) {
    rep(x, 1, 2) rep(y, 1, 2) {
      int s = n - x - y - (k - 2);
      if (s < 0 || (s & 1)) continue;
      ll ways = C(s / 2 + k - 1, k - 1);
      ll avg = (s * F(k) + 1) % MOD;
      ll sum = (pp[n] - pp[k - 1] - pp[n - k] + MOD * 2) % MOD;
      ll now = ways * avg % MOD * sum % MOD;
      ans = (ans + now) % MOD;
      if (x == 2) {
        ans = (ans + ways * p[n + 1 - k] % MOD) % MOD;
      }
      if (y == 2) {
        ans = (ans + ways * (p[n] - p[k - 1] + MOD) % MOD) % MOD;
      }
    }
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  init(N * 2 - 1);

  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}